package com.dev;
import android.view.View;
import android.widget.LinearLayout;
import com.log;
import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
public class ArchiveListPage extends LinearLayout{//browser zip,tar,gzip,etc...
	MainActivity ma;
	boolean indentItem;
	ArchiveDir ad;
	File src;
	ZipTree[] zipWillShow;
	ZipTree root;
	LayoutParams pageLayoutParams=new LayoutParams(-1,0,1f);
    ArchiveListPage(MainActivity ma){
		super(ma);
		this.ma=ma;
		setOrientation(VERTICAL);
		ad=new ArchiveDir(ma);
		addView(ad,pageLayoutParams);
	}
	void readZip(File f){
		try{
			FileInputStream fis=new FileInputStream(f);
			ZipInputStream zis=new ZipInputStream(fis);
			ZipEntry ze=zis.getNextEntry();
			root=new ZipTree();
			while(ze!=null){
				ze=zis.getNextEntry();
			}
			zis.close();
			fis.close();
		}catch(Exception e){
			log.alert("无法读取压缩文件");
		}
	}
	class ArchiveDir extends MyListView{
		ArchiveDir(MainActivity ma){
			super(ma);
		}
		@Override
		public int getCount() {
			return 0;
		}
		@Override
		public View getView(View convert, int position) {
			return null;
		}
	}
	class ZipTree{
		String name;
		ZipTree parent;
		ArrayList<ZipTree> child;
		ZipEntry ze;
		void addZipEntry(ZipEntry ze){
			String name=ze.getName();
			String[] split=name.split("/");
			ZipTree cur=this;
			outmost:
			for(int index=0;true;index++){
				if(index<split.length){
					String s=split[index];
					if(s.isEmpty()){
						continue;
					}else if(cur.child==null){
					}else{
						for(int n=0,size=cur.child.size();true;n++){
							if(n<size){
								ZipTree zt=cur.child.get(n);
								if(zt.name.equals(s)){
									cur=zt;
									break;
								}
							}else{
								break;
							}
						}
					}
				}else{
					break;
				}
			}
		}
	}
}
